package com.wangzhixuan.service.impl;

import java.util.List;
import java.util.Map;

import com.wangzhixuan.commons.utils.PageInfo;
import com.wangzhixuan.model.EleSpec;
import com.wangzhixuan.mapper.EleSpecMapper;
import com.wangzhixuan.service.IEleSpecService;
import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhixuan.wang
 * @since 2017-09-25
 */
@Service
public class EleSpecServiceImpl extends ServiceImpl<EleSpecMapper, EleSpec> implements IEleSpecService {
	
	@Autowired
    private EleSpecMapper eleSpecMapper;
    
	@Override
    public void selectDataGrid(PageInfo pageInfo) {
    	Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
        page.setOrderByField(pageInfo.getSort());
        page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
        List<EleSpec> list = eleSpecMapper.selectEleSpecPage(page, pageInfo.getCondition());
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

	public List<EleSpec> listEleSpec() {
		List<EleSpec> listEleSpec = eleSpecMapper.listEleSpec();
		return listEleSpec;
	}

	@Override
	public Integer selectEnty(String content) {
		Integer specId = eleSpecMapper.selectSpecId(content);
		return specId;
	}
	
}
